var tm = new Date().getTime();
if(!window.zm) {
	zm = {};
};
/*正则*/
var isnumber = /^\d+$/;
var isemail = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
var isurl = /^https?:\/\/(([a-zA-Z0-9_-])+(\.)?)*(:\d+)?(\/((\.)?(\?)?=?&?[a-zA-Z0-9_-](\?)?)*)*$/i;
var isphone = /^1[34578]\d{9}$/;
var isidcard = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/;
var iszipcode = /^[1-9]\d{5}(?!\d)$/;
var isnull;
zm.rules = function(ruleskey, value, valueText) {
	switch(ruleskey) {
		case "isnull":
			if(value=="") {
				YDUI.dialog.alert(valueText);
				return false
			}
			break;
		case "isnumber":
			if(!isnumber.exec(value)) {
				YDUI.dialog.alert(valueText);
				return false
			}
			break;
		case "isemail":
			if(!isemail.exec(value)) {
				YDUI.dialog.alert(valueText);
				return false
			}
			break;
		case "isurl":
			if(!isurl.exec(value)) {
				YDUI.dialog.alert(valueText);
				return false
			}
			break;
		case "isphone":
			if(!isphone.exec(value)) {
				YDUI.dialog.alert(valueText);
				return false
			}
			break;
		case "isidcard":
			if(!isidcard.exec(value)) {
				YDUI.dialog.alert(valueText);
				return false
			}
			break;
		case "iszipcode":
			if(!iszipcode.exec(value)) {
				YDUI.dialog.alert(valueText);
				return false
			}
			break;
		default:
			break
	}
}